package com.cskaoyan.wordmemorize.task;

import com.cskaoyan.wordmemorize.dao.entity.UserRemindDO;
import com.cskaoyan.wordmemorize.service.UserService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@EnableScheduling
@Slf4j
public class UserMessageRemindTask {

    @Resource
    UserService userService;

    // 每分钟执行一次检查
//    @Scheduled(cron = "0,20,40 * * * * ?")
    @Scheduled(cron = "0 * * * * ?")
    public void initialize() {
        log.info("执行任务....");

        // 每分钟调用一次 提醒方法
        userService.messageRemind();

        log.info("任务结束....");
    }
}
